#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "Material.h"

Material::Material(char * name, char * fileName, float bounciness, float staticFriction, bool isGrabable, float size)
{
	this->name = name;
	this->fileName = fileName;
	this->bounciness = bounciness;
	this->maxStaticFriction = staticFriction;
	this->isGrabbable = isGrabbable;
	this->size = size;
}
Material::~Material()
{
	if(name)
	{
		delete name;
		name = NULL;
	}
	if(fileName)
	{
		delete fileName;
		fileName = NULL;
	}
}
	
char * Material::GetTag()
{
	char * tag = (char *)malloc(strlen(name)+strlen(fileName)+40);
	int grab = 0;
	if(isGrabbable)
		grab = 1;
	sprintf(tag, "<material,%s,%s,%f,%f,%d,%f>",name, fileName, bounciness, maxStaticFriction, grab,size);
	return tag;
}
